updated main.c run it and test it, there is some logic errors in the methods