Fixed relative path bugs, conflicted code and added library for define.