Split into separate classes. Added interfaces