First pass at the code