package structure refactored
attila's fixes merged into refactored state