implemented all functions