changed it a little bit. Removed small useless pieces of code.