refactored. removed stupid function