add in code output functionality. not entirely right yet, but a good start