new functions added, bugs fixed