component initialization check added, and code refectored