Proof of concept. Fixed minor bugs.