removed some duplicated lines of code