simplyfing some code