still having trouble putting all functions together