Final working version (Might be improved to not need a modified JSAnimation class)