Several small changes. Added cluster functions