first commit with some rough prototype
added optimizer
little improvements