added method definitions and test cases