refactored feature functions. added test for them