Organized code; fixed style issues