added some new functions, overloaded operators and fixed bugs