some algorithms implementiom