Refactor & attachments

Did the refactor after implementing attachments so we can kill two birds with one stone here.