Fixing bug related to chain creation
TODO: Get ajax method, Improve tests