first version of course project. Working but messy