made minor changes to clean up code