implemented all functions for lab