added features to add and some minor fixes