update routes && efactoring the code