Finished general code structure