cleaning up the code a little bit
refactoring bits of code