Fixed errors and improved general