Rework program:
 - implement logical layer
 - implement and use layers
 - adding some checks
 - implement authenticator
 - correct some bugs