tidy the code up, fix last issue for miss typing