simplified some code..