improved code readability

using forM_ instead of code repetition