Working code as of date, about to clean up in code