Initial revision. Good functionality, see TODO