reverted to commit before merging functions into one