functions are completed, needs testing