tweaked some functions