finalized basic functionality