fixed bugs, started using cmake