implemented missing functions, cleanup