batlab start code

an initial attempt, haven't been able to test.