Fixed some inefficiences