modularize into classes