initial checkin of rewritten code