Removed all the repeated code