First attempt to implement proper architecture - not finished yet