made changes as requested to clean up code