moved functions to respective files