Removed duplication of code