Saturday project. A lot of rebase and code correction needed.