organized the functions better