Simplified attach().

MILESTONE: attach() is now implemented the way it should be.