got ready to check input. still need to fix memory leaks