Edited for style - fixed some JSHint problems