#251

Refactored everything, separated into different classes