Initial import of the code. It somewhat works