Fixed some architectural problems