cleaned up the code according to the suggestions by @enovajuan