many additional function implemented; redundant functions removed; package errors corrected