Revised and cleaned up some code
Made Code more consistent