final working first version