Fixed bugs and replace ajax methods - simple functions