implemented layout with some margin errors