*It's critical for beans not to overcrowd them, use a large pot, using a smaller pot just prolongs the cooking.*
In a large pot, pour your dried beans. *If you're using canned beans you don't need to cook the beans as long, just make sure they're cooked well*
Add water to the pot, enough so you have a few good inches above the beans. When cooking beans, it's safer to add more water than less.
Then add all of your other ingredients except your olive oil and lime juice.
Put the lid on your pot and at a medium heat cook the beans.
Cook for two to three hours, stirring intermittently. Make sure you have enough water, you don't want all your water to dissolve before the beans are cooked.
Once the beans are cooked (taste a few to make sure, it should basically melt in your mouth), take the lid off of the pot. Then cook for another 15 minutes and allow the water to reduce down, it'll make almost a thick sauce like liquid. Now add your lime juice and olive oil. Turn off the heat and proceed to mash the beans until you have a thick paste. I use a potato masher to do the job, depending on how smooth you like the beans you can mash the beans longer or shorter.
The beans keep very well, I love using them as a side for my lunches. If you make too much, you can also freeze the beans.
Enjoy!