made some geberal improvements and added some methods