adds tests and more robust pattern builder
remove a todo!