added cluster implementation, minor changes