functional

Still some fine tuning, but this is good for now.