Edited for consistency
Lots of cleanup