bug fixes for previous temp version. This version will run and the basic functionality of checkAgainstPolicy works. However, there's still many TODOs to cover all scenarios.