fixed attachment view and some cleanup