updated implementation
minor fixes