Bug fixes + ajax stuff