Up and running. Code is kinda messy, but it works