Fixed issues from last commit, moved ajax call into chrome API handler to
prevente timing issues