Cleaned code, fixed bugs, added licenses