reformatted most of the source to my liking