Refactor code, add license and readme