Added more tests and refactored before_save callback