#40 complete implementation + test fix