functions implemented but apparently not working correctly yet