cleaning database feature added, several bugs fixed