v 0.6, fixed TODOs, cleaner shorter impl