Fixed core source files and wrote a new makefile for Ubuntu.