Removing duplicate code

Just to avoid duplicates and make maintenance easier