Fixed various bugs.
Added delegate and datasource methods.