Removes repeated code