initial AST code. needs to be tested on rpi.