Refactor the chip file a bit, move bash test files from test dir