Fixed working implementation.