initial working version, some broken tests

@feanil