Attachment support

Based on #28 this PR introduces attachment support.