Restructured file and added print code