version 0.5: mostly working