refactored into module for later libbing