module decomposition

module decomposition and bug fix