Removed all repeated code