refactored bin