Cleaned repeated code.