added some more logic

cleaned up the code a little, added some statements