Removed unnecessary repetition of code