Fixed the bugs in the new functionalities and didn't remove the test function yet