added features and bug fixes