refactor a bit with more consistent syntax, remove TODO